import React from 'react';
import { Route, Redirect } from 'react-router-dom';

export class PermissionAuth extends React.Component {
    render () {
        const { location, config } = this.props;
        const { pathname } = location;
        // const isLogin = store.getState().user.data.token;
        const isLogin = false

        // 如果该路由不用进行权限校验，登录状态下登陆页除外
        // 因为登陆后，无法跳转到登陆页
        // 这部分代码，是为了在非登陆状态下，访问不需要权限校验的路由
        const targetRouterConfig = config.find(v => v.path === pathname);
            const { component } = targetRouterConfig;
            return <Route exact path={ pathname } component={ component } />



    }
}
